package com.perfma.xtest.tool;


import com.google.common.collect.Lists;

import java.util.List;

/**
 * @author: junhui.si
 * @date: 2024-03-21 11:20
 **/
public class Chai {

    public static void main(String[] args) {
        List<Integer> curScriptStrategyList = Lists.newArrayList(3, 0);
        int taskNum = 6;
        for (int i = 1; i <= taskNum; i++) {
            for (int j = 0; j < curScriptStrategyList.size(); j++) {
                int step = currentValue(curScriptStrategyList.get(j), taskNum, i - 1);
                System.out.println(step);
            }
        }
    }

    public static int currentValue(int originalNum, int count, int currentIndex) {

        //原始值为0则直接返回
        if (originalNum == 0) {
            return 0;
        }
        //原始值为1，则第一个为1后续为0
        if (originalNum == 1) {
            if (currentIndex == 0) {
                return originalNum;
            } else {
                return 0;
            }
        }

        //原始值大于1
        int averageNum = originalNum / count;
        int remainNum = originalNum % count;
        if (remainNum == 0 || currentIndex < count - 1) {
            return averageNum;
        } else {
            return originalNum - averageNum * (count - 1);
        }
    }
}
